<template>
	<view class="uni-padding-wrap">
		<wxParse :content="article" @preview="preview" @navigate="navigate" />
	</view>
</template>

<script>
//本示例引用组件为三方的mpvue-wxparse，该组件为开源mit协议，如有新需求可自行改动完成或联系原作者
	import marked from '../../components/marked'
	import wxParse from '../../components/mpvue-wxparse/src/wxParse.vue'


	export default {
		components: {
			wxParse
		},
		data() {
			return {
				article: marked('<pre class="brush:html;toolbar:false">fasfasfasd梵蒂冈大商股份</pre><p>编辑器默认文字<br/></p>')
			}
		},
		methods: {
			preview(src, e) {
				// do something
				console.log("src: " + src);
			},
			navigate(href, e) {
				// 如允许点击超链接跳转，则应该打开一个新页面，并传入href，由新页面内嵌webview组件负责显示该链接内容
				console.log("href: " + href);
				uni.showModal({
					content : "点击链接为：" + href,
					showCancel:false
				})
			}
		}

	}
</script>

<style>
	@import url("../../components/mpvue-wxparse/src/wxParse.css");
</style>
